package  
{
	import org.flixel.plugin.photonstorm.BaseTypes.Bullet;
	import org.flixel.plugin.photonstorm.FlxWeapon;
	/**
	 * ...
	 * @author Billy Kaifer
	 */
	public class Weapon extends FlxWeapon
	{
		private var fireRate:uint = 100;
		
		public function Weapon(name:String, parentRef:* = null, xVariable:String = "x", yVariable:String = "y") 
		{
			super("weapon", parentRef, xVariable, yVariable);
		}
		
		protected function getFreeBullet():Bullet {
			var result:Bullet = null;
			
			if (group == null || group.length == 0)
			{
				throw new Error("Weapon.as cannot fire a bullet until one has been created via a call to makePixelBullet or makeImageBullet");
				return null;
			}
			
			for each (var bullet:Bullet in group.members)
			{
				if (bullet.exists == false)
				{
					result = bullet;
					break;
				}
			}
			
			return result;
		}
		
		override public function getFireRate():uint {
			return fireRate;
		}
		
		override public function setFireRate(rate:uint):void {
			super.setFireRate(rate);
			fireRate = rate;
		}
	}

}